#include "mex.h"
#include <math.h>

static void scalarxarray(double sca, double arr[], int N)
{
    int i;
    for(i=0;i<N;i++)
        arr[i]=sca*arr[i];

}

static void neo(double* asset,int Npath,int Dtime)
{
    int i,j;
    for (j=0;j<Dtime;j++)
            for(i=0;i<Npath;i++)
                asset[j*Npath+i]=0.0;
}

static void arrtest(double* asset, double* eta,int Npath, int betaK, int Dtime)
{
    int i,j,k,iter, counter=0,column=betaK*(betaK-1)/2;
    double currentx;
 

//         for (j=0;j<Dtime;j++)
//         {
//             for(i=0;i<Npath;i++)
//                 asset[j*Npath+i]=counter++;
//         }
    
    for(i=0;i<Npath;i++)
        for (j=0;j<Dtime;j++)
            asset[j*Npath+i]=counter++;


}


void mexFunction(int nlhs,mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
        double *asset, *eta,*etasquare,*etaeta, *X1, *test;
        int Npath,betaK,Dtime;
        int i;
        
        Npath=mxGetM(prhs[0]); 
        Dtime=mxGetN(prhs[0]);
        //Dtime=mxGetM(prhs[3]);
        //Dtime=3;
        
        plhs[0]=mxCreateDoubleMatrix(Npath,Dtime,mxREAL);
//        plhs[1]=mxCreateDoubleMatrix(Dtime,1,mxREAL);
        
        asset=mxGetPr(plhs[0]);
        
        eta=mxGetPr(prhs[0]);
        //etasquare=mxGetPr(prhs[1]);
        //etaeta=mxGetPr(prhs[2]);
        
        //X1=mxGetPr(prhs[3]);
        
        //test=mxGetPr(plhs[1]);
        
        
        neo(asset,Npath,Dtime);
        arrtest(asset,eta,Npath,betaK,Dtime);


}
